<%@ page pageEncoding="utf-8"%> 
<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>

<%
	request.setAttribute("layout","main.jsp");
	request.setAttribute("page_title","温岭选课系统-课程申报审核");
	int i = 0;
  	List<Hashtable<String, String>> waitcheck_list = (List<Hashtable<String, String>>) session.getAttribute("WaitcheckList");
	Iterator<Hashtable<String, String>> waitcheck_it = waitcheck_list.iterator();
  	List<Hashtable<String, String>> checked_list = (List<Hashtable<String, String>>) session.getAttribute("CheckedList");
	Iterator<Hashtable<String, String>> checked_it = checked_list.iterator();
 %>
	<link href="css/jquery.ui.tabs.css" rel="stylesheet">
	<link href="css/jquery.ui.theme.css" rel="stylesheet">
	<script src="js/jquery-1.5.2.min.js"></script>
	<script src="js/jquery-ui-1.8.11.custom.min.js"></script>
	<script src="js/jquery.ui.tabs.js"></script>
	<script type="text/javascript" src="js/popup.js"></script>
	
	<script>
	$(function() {
		$( "#tabs" ).tabs();
		
	});
	
	function check(courseId){
	   $.ajax({
			url: base_path+"Admin/adminCheck.do",
			type: "POST",
			data: {"method":"measuring"},
            data: {"courseId":courseId}, 
			beforeSend: function(XMLHttpRequest){
			},
			success: function(data, textStatus){
				if(data=="success"){
				
				}else{ 
				
				}
			},

			complete: function(XMLHttpRequest, textStatus){
				//$("#td_teacher").html("<font color=#ff0000>用户名或密码错误</font>");
				//alert("hello");
				ShowIframe('审批课程申请',base_path+"admin/courseApplyApproveDetail.jspx?courseId=+id",700,600);
				//window.location.href="courseApplyApproveDetail.jspx?";
			},
			error: function(){
				$("#ajaxResult").html("服务器异常，请联系网络管理员");
			}
		});
   }
	function checkdetail(courseId){
		   $.ajax({
				url: base_path+"Admin/approveDetail.do",
				type: "POST",
				data: {"method":"measuring"},
	            data: {"courseId":courseId}, 
				beforeSend: function(XMLHttpRequest){
				},
				success: function(data, textStatus){
					if(data=="success"){
					
					}else{ 
					
					}
				},

				complete: function(XMLHttpRequest, textStatus){
					ShowIframe('课程审批详情',base_path+"admin/courseApproveDetail.jspx",600,400);
				},
				error: function(){
					$("#ajaxResult").html("服务器异常，请联系网络管理员");
				}
			});
	   }
	
	</script>
	<div id="td_teacher"></div>
<div style="width:100%; margin:1px;text-align:center;margin-top:10px;margin-bottom:50px;">
 	<p style="border:0;font-size:14px;padding-bottom:0;text-align:center;">
 		<b>课程申报记录</b>
  		<select>
  			<option value="全部">全部</option>
  			<option value="2011年第一学期">2011年第一学期</option>
  			<option value="2011年第二学期">2011年第二学期</option>
  			<option value="2012年第一学期">2012年第一学期</option>
  		</select>
	</p>
	  <div id="tabs" style="height:100%;width:90%;margin-left:5%;">
		<ul>
			<li><a href="#tabs-1">待审批</a></li>
			<li><a href="#tabs-2">历史审批</a></li>
		</ul>
		<div id="tabs-1" style="width:100%;margin-left:0;padding-left:0;margin-top:20px;">
			<table>
		    		<tbody>
		              <tr height="32" bgcolor="#f0f0f0">
		                    <td align="center" width="7%">课程编号</td>
		              		<td align="center" width="12%">学期</td>
		                    <td align="center" width="8%">课程类型</td>
		                    <td align="center" width="14%">课程名称</td>
		                    <td align="center" width="8%">授课老师</td>
		                    <td align="center" width="20%">课程状态</td>
		                    <td align="center" width="6%">人数限额<br>
		                      (最少/最多)</td>
		                    <td align="center" width="6%">审批</td>
		             </tr>
		             <%
		           		waitcheck_it = waitcheck_list.iterator();
		        		while(waitcheck_it.hasNext())
							{
								Hashtable<String, String> waitcheck_hash  = waitcheck_it.next();
					%>
			  		  <tr height="25" bgcolor="#ffffff">
		                 <td align="center"><%=waitcheck_hash.get("classno") %></td>
			  		  	 <td align="center"><%=waitcheck_hash.get("year") %><%=waitcheck_hash.get("openterm") %></td>
		                 <td align="center"><%=waitcheck_hash.get("type") %></td>
		                 <td align="center"><%=waitcheck_hash.get("name") %> </td>
		                 <td align="center"><%=waitcheck_hash.get("teachers") %> </td><td align="center">
		                 	<% if(waitcheck_hash.get("checkstatus").equalsIgnoreCase("0")){%>
			             		审核中
				             	<% }else if(waitcheck_hash.get("checkstatus").equalsIgnoreCase("1")){ %>
				             		审核通过
				             	<%}else if(waitcheck_hash.get("checkstatus").equalsIgnoreCase("2")){ %>
				             		审核不通过
				             	<%}else if(waitcheck_hash.get("checkstatus").equalsIgnoreCase("3")){ %>
				             		选课中
				             	<%}else if(waitcheck_hash.get("checkstatus").equalsIgnoreCase("4")){ %>
				             		开课
				             	<%}else if(waitcheck_hash.get("checkstatus").equalsIgnoreCase("5")){ %>
				             		结束
				             	<%} %>
		                 </td>
		                 <td align="center"><%=waitcheck_hash.get("students_low") %>/<%=waitcheck_hash.get("students_high") %> </td>
		                 <td align="center"><a href="javascript:check(<%=waitcheck_hash.get("Id") %>)"   class="approve">[审批]</a></td>
		               </tr>
			  		<%} %>
		      </tbody>
		   </table>
		</div>
		<div id="tabs-2" style="width:100%;margin-left:0;padding-left:0;margin-top:20px;">
			<table>
		    		<tbody>
		              <tr height="32" bgcolor="#f0f0f0">
		                    <td align="center" width="7%">课程编号</td>
		              		<td align="center" width="12%">学期</td>
		                    <td align="center" width="8%">课程类型</td>
		                    <td align="center" width="14%">课程名称</td>
		                    <td align="center" width="8%">授课老师</td>
		                    <td align="center" width="20%">课程状态</td>
		                    <td align="center" width="6%">人数限额<br>
		                      (最少/最多)</td>
		                    <td align="center" width="6%">查看</td>
		             </tr>
			  		   <%
		           		checked_it = checked_list.iterator();
		        		while(checked_it.hasNext())
							{
								Hashtable<String, String> checked_hash  = checked_it.next();
					%>
						<tr>
		                 <td align="center"><%=checked_hash.get("classno") %></td>			  		  	 <td align="center"><%=checked_hash.get("year") %><%=checked_hash.get("openterm") %></td>
		         		 <td align="center"><%=checked_hash.get("type") %></td>
		                 <td align="center"><%=checked_hash.get("name") %> </td>
		                 <td align="center"><%=checked_hash.get("teachers") %> </td>
		                 <td align="center">
		                 	<% if(checked_hash.get("checkstatus").equalsIgnoreCase("0")){%>
			             		审核中
				             	<% }else if(checked_hash.get("checkstatus").equalsIgnoreCase("1")){ %>
				             		审核通过
				             	<%}else if(checked_hash.get("checkstatus").equalsIgnoreCase("2")){ %>
				             		审核不通过
				             	<%}else if(checked_hash.get("checkstatus").equalsIgnoreCase("3")){ %>
				             		选课中
				             	<%}else if(checked_hash.get("checkstatus").equalsIgnoreCase("4")){ %>
				             		开课
				             	<%}else if(checked_hash.get("checkstatus").equalsIgnoreCase("5")){ %>
				             		结束
				             	<%} %>
		                 </td> 
		                 <td align="center"><%=checked_hash.get("students_low") %>/<%=checked_hash.get("students_high") %></td>
		                 <td align="center"><a href="javascript:checkdetail(<%=checked_hash.get("Id") %>)">[查看]</a></td>
		               </tr>
			          <%
			          }
			          %>
		      </tbody>
		   </table>
		</div>
		
	</div>
</div>

